<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>编辑管理员</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<link rel="stylesheet" href="admin/css/common.css" type="text/css" />
<link rel="stylesheet" href="admin/css/provider.css" type="text/css" />
<script type="text/javascript" src="admin/js/province-city.js"></script>
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript">
function check(){
	if($('#title').val()==""){
		$('#titleTip').text("*名字不能为空");
		$('#title').focus();
		return false;
	}else if($('#password').val() != $('#passwordChk').val()){
		$('#pwdTip').text("");
		$('#pwdChkTip').text("*两次密码不相同");
		$('#passwordChk').focus();
		return false;
	}
	return true;
}

function checkName() {
	$('#titleFlag').val("no");
	if ($("#title").val() != "") {
		var params = {
			userName : $("#title").val(),
			checkflag : "update",
			adminId : $('#adminId').val()
		};
		jQuery.post("checkAdminNameExist.action", params, callbackFunc, "json");
	}
}
function callbackFunc(data) {
	if (data.existFlag > 0) {
		$('#titleTip').html('<font color="red">*名字已经存在</font>');
		$('#titleFlag').val("no");
	} else {
		$('#titleTip').html('<font color="green">名字可以使用</font>');
		$('#titleFlag').val("yes");
	}
}
</script>
</head>
<body>
	<div id="provider_zone">
		<form action="admin/updateAdministrator.action" method="post"
			enctype="multipart/form-data" onsubmit="return check();">
			<table width="99%" border="0" align="center" cellpadding="3"
				cellspacing="1" class="table_style">
				<tr>
					<td class="left_title_1">管理员名字</td>
					<td><input type="text" name="admin.username" id="title"
						value="${admin.username }" onblur="checkName()" /> <span
						class="tip" id="titleTip"></span> <input type="hidden"
						id="titleFlag" value="yes" /></td>
				</tr>
				<tr>
					<td class="left_title_2">设置新密码</td>
					<td><input type="password" id="password" name="admin.password" />
						<span class="tip" id="pwdTip"></span>
					</td>
				</tr>
				<tr>
					<td class="left_title_1">新密码确认</td>
					<td><input type="password" id="passwordChk" name="passwordChk" />
						<span class="tip" id="pwdChkTip"></span>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="padding-left: 530px;"><input
						type="submit" class="input-submit" value="更新信息" /> <input
						type="hidden" value="${adminId }" name="adminId"
						id="adminId" /> <input type="hidden" value="${adminId }"
						name="admin.id" /></td>
				</tr>
			</table>
		</form>
	</div>
</body>
</html>
